package com.zzcon.sckill.web;

import com.zzcon.sckill.annotation.LimitRate;
import com.zzcon.sckill.common.AjaxResponseDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/testRateController")
public class RateTestController {

    @ApiOperation("测试流量限制")
    @PostMapping("/testRate")
    @LimitRate(key = "rate_limit_test",limit = 1,message = "接口访问速度超过了接口限定的最大速度")
    public AjaxResponseDTO<Void> testRete(){
        AjaxResponseDTO responseDTO = new AjaxResponseDTO();
        responseDTO.setSuccess(true);
        responseDTO.setErrorMsg("");
        return responseDTO;
    }

}
